package library.holdings;

public class Video extends HoldingImpl {
    private int length;

    public Video(String title, int length) {
        super(title);
        setLength(length);
    }

    public void setLength(int length) {
        if (length < 0)
            throw new IllegalArgumentException("negative length");
        this.length = length;
    }

    public int getLength() {
        return length;
    }

    public String toString() {
        return "Video: " + super.toString() + " length: " + length;
    }

    public boolean equals(Object rhs) {
        if (rhs instanceof Video) {
            Video v = (Video) rhs;
            return super.equals(rhs) && length == v.length;
        }
        return false;
    }
}
